package com.ant.storage.service.impl;

import com.ant.storage.dto.MonthlyDto;
import com.ant.storage.dto.PurchaserRecordDto;
import com.ant.storage.handler.AntException;
import com.ant.storage.mapper.PurchaserRecordImgMapper;
import com.ant.storage.pojo.PurchaserRecordImg;
import com.ant.storage.pojo.SupplierInformation;
import com.ant.storage.pojo.SupplierPayList;
import com.ant.storage.service.IPurchaserRecordImgService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author hzd
 * @version 1.0
 * @date 2022/5/19 14:25
 */
@Service
public class PurchaserRecordImgServiceImpl
        extends ServiceImpl<PurchaserRecordImgMapper, PurchaserRecordImg>
        implements IPurchaserRecordImgService {

    @Override
    public PageInfo<PurchaserRecordImg> finsPurchaserRecordImg(PurchaserRecordDto dto) {
        try {
            PageHelper.startPage(dto.getPageIndex(), dto.getPageSize());
            QueryWrapper<PurchaserRecordImg> wrapper=new QueryWrapper<>();
            wrapper.orderByDesc("id");
            List<PurchaserRecordImg> list = this.baseMapper.selectList(wrapper);
            PageInfo<PurchaserRecordImg> pageInfo = new PageInfo<>(list);
            return pageInfo;
        } catch (Exception e) {
            throw new AntException(e.getMessage());
        }
    }
}
